package com.example.function.sys.model.pojo;

/**
 * <h1>用户最小属性对象</h1>
 * Created by hanqf on 2021/8/3 10:33.
 */


import com.example.function.sys.model.one.SysUser;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 用户查询返回结果封装
 */
@Data
public class SysUserMiniPojo implements Serializable {
    private static final long serialVersionUID = 795896926345005188L;
    /*
     * 主键id
     */
    private Long id;


    /*
     * 登录帐号，供应商邮箱
     */
    private String userLoginName;

    /*
     * 姓名，供应商全称
     */
    private String userName;

    public static SysUserMiniPojo wrapper(SysUser sysUser) {
        SysUserMiniPojo sysUserMiniPojo = new SysUserMiniPojo();
        BeanUtils.copyProperties(sysUser, sysUserMiniPojo);
        return sysUserMiniPojo;
    }

    public static List<SysUserMiniPojo> wrapper(List<SysUser> sysUsers) {
        List<SysUserMiniPojo> list = new ArrayList<>();
        for (SysUser sysUser : sysUsers) {
            list.add(SysUserMiniPojo.wrapper(sysUser));
        }
        return list;
    }

}
